<?php
session_start();
require_once("Structure/fonctions.php");

$PAGE_TITLE = "Mon Compte - Lolgames";
$CONTENT_INCLUDE = "articlesList.html";

$bdd = mysqli_connect(DB_HOST, DB_USER, DB_PWD, DB_BASE);

include("Structure/updateUser.php");

$sortLA = "date";
$orderLA = "DESC";

if(isset($_POST['allArtsSortPost']))
{
	$sortLA = $_POST['sort'];
	$orderLA = $_POST['order'];
}

$query = "SELECT    a.id, title, content, type, note, a.date, a.statusID, a.autorID, u.pseudo autor, link, i.statusID imgStatus
          FROM      articles a
          JOIN      images i ON a.imageID = i.id
          JOIN      users u ON a.autorID = u.id
          WHERE     a.type = '".$_GET["type"]."'
            AND     a.statusID = 1
          ORDER BY  ".$sortLA." ".$orderLA." ;";

$res_artsList = mysqli_query($bdd, $query) or die(mysqli_error($bdd));


include_once("/Structure/structure.php");

?>